package com.app.gson;

import java.lang.reflect.Type;
import java.util.Calendar;

import com.app.util.Util;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

public class CalendarDeserializer implements JsonDeserializer < Calendar > {

    @Override
    public Calendar deserialize(JsonElement json, Type arg1,
	    JsonDeserializationContext arg2) throws JsonParseException {
	Calendar c = Calendar.getInstance();
	c.setTime(Util.stringToDate(json.getAsString(), Util.FORMAT_DATE_JSON));
	return c;
    }


}
